﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace BilingualSentSearchEngine
{
    class DataAnalysis
    {
        StreamWriter swData;
        object _privateObject = new object();

        public DataAnalysis(string strFileName)
        {
            lock (_privateObject)
            {
                swData = new StreamWriter(strFileName, true);
            }
        }

        public void WriteEntry(ref string strQuery, ref List<SentencePair> spList)
        {
            StringBuilder sb = new StringBuilder(128);
            sb.Append(strQuery);
            foreach (SentencePair sp in spList)
            {
                sb.Append("\t");
                sb.Append(sp.score);
            }
            lock (_privateObject)
            {
                swData.WriteLine(sb.ToString());
            }
        }
    }
}
